/*
*    Phantom Test Driver v2.0 GUI Automation Software
*    Copyright (C) 2009  John C. Van Arsdall (john@phantomtest.com)
*
*    This program is free software; you can redistribute it and/or modify
*    it under the terms of the GNU General Public License as published by
*    the Free Software Foundation; either version 2 of the License, or
*    (at your option) any later version.
*
*    This program is distributed in the hope that it will be useful,
*    but WITHOUT ANY WARRANTY; without even the implied warranty of
*    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
*    GNU General Public License for more details.
*
*    You should have received a copy of the GNU General Public License along
*    with this program; if not, write to the Free Software Foundation, Inc.,
*    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
*/
/*
 * PTDRegistrationFrame.java
 *
 * Created on June 29, 2007, 12:08 PM
 */

package ptd;

import java.awt.Dimension;
import java.awt.Toolkit;
import javax.swing.ImageIcon;

/**
 *
 * @author  John
 */
public class PTDRegistrationFrame extends javax.swing.JFrame {

    
    public boolean bWaiting = true;
    
    /** Creates new form PTDRegistrationFrame */
    public PTDRegistrationFrame(boolean bExpired) {
        initComponents();
        ImageIcon a = PTDImageLoader.getImageIcon(PTDImageLoader.IMG_PTD_ICON);
        setIconImage(a.getImage());
        this.setSize(290, 230);
        OKButton.setText("OK");
        
        getRootPane().setDefaultButton((OKButton));
        
        PTDLabel.setText("Phantom Test Driver v2.0");
        LicenseLabel.setText("Enter License Key:");
        ContinueLabel.setText("Click 'OK' to continue evaluation");
        if(bExpired){
            EvalLabel.setText("Evaluation Copy - Expired");            
            LicenseLabel.setVisible(true);
            LicenseText.setVisible(true);
        }else{
            EvalLabel.setText("Evaluation Copy");
            //LicenseLabel.setVisible(false);
            //LicenseText.setVisible(false);
        }
        a = PTDImageLoader.getImageIcon(PTDImageLoader.IMG_PTD_LABEL);
        IconLabel.setIcon(a);
        
        Dimension dim = Toolkit.getDefaultToolkit().getScreenSize();
        this.setLocation((dim.width-290)/2, (dim.height-190)/2);
        
    }
    
    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        OKButton = new javax.swing.JButton();
        PTDLabel = new javax.swing.JLabel();
        EvalLabel = new javax.swing.JLabel();
        IconLabel = new javax.swing.JLabel();
        LicenseText = new javax.swing.JTextField();
        LicenseLabel = new javax.swing.JLabel();
        ContinueLabel = new javax.swing.JLabel();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setTitle("Evaluation Copy");
        setAlwaysOnTop(true);
        setResizable(false);
        getContentPane().setLayout(null);

        OKButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                OKButtonActionPerformed(evt);
            }
        });
        getContentPane().add(OKButton);
        OKButton.setBounds(110, 140, 75, 23);

        PTDLabel.setFont(new java.awt.Font("Arial Black", 0, 18));
        PTDLabel.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        getContentPane().add(PTDLabel);
        PTDLabel.setBounds(10, 50, 260, 30);

        EvalLabel.setFont(new java.awt.Font("Arial Black", 0, 12));
        EvalLabel.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        getContentPane().add(EvalLabel);
        EvalLabel.setBounds(10, 70, 260, 30);
        getContentPane().add(IconLabel);
        IconLabel.setBounds(100, 0, 60, 60);

        LicenseText.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                LicenseTextActionPerformed(evt);
            }
        });
        getContentPane().add(LicenseText);
        LicenseText.setBounds(120, 110, 150, 20);
        getContentPane().add(LicenseLabel);
        LicenseLabel.setBounds(10, 110, 110, 20);
        getContentPane().add(ContinueLabel);
        ContinueLabel.setBounds(60, 170, 190, 20);

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void OKButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_OKButtonActionPerformed
        PTDOptions.m_LicenseKey = LicenseText.getText();
        bWaiting = false;
        dispose();
    }//GEN-LAST:event_OKButtonActionPerformed

private void LicenseTextActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_LicenseTextActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_LicenseTextActionPerformed
    
    /**
     * @param args the command line arguments
     */
    //public static void main(String args[]) {
    //    java.awt.EventQueue.invokeLater(new Runnable() {
    //        public void run() {
    //            new PTDRegistrationFrame(true).setVisible(true);
    //        }
    //    });
    //}
    
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JLabel ContinueLabel;
    private javax.swing.JLabel EvalLabel;
    private javax.swing.JLabel IconLabel;
    private javax.swing.JLabel LicenseLabel;
    private javax.swing.JTextField LicenseText;
    private javax.swing.JButton OKButton;
    private javax.swing.JLabel PTDLabel;
    // End of variables declaration//GEN-END:variables
    
}
